home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Commun⁄Network / Telnet 2.5.src.ThinkC / source / vsem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-17  |  16.5 KB  |  628 lines  |  [TEXT/MPS ]

  1. #ifdef lint
  2. static char *SCCSid = "%W%    (NCSA)    %G%";
  3. #endif
  4.  
  5. /*
  6.  *
  7.  *      Virtual Screen Kernel Emulation Routines
  8.  *                      (vsem.c)
  9.  *  
  10.  *   National Center for Supercomputing Applications
  11.  *      by Gaige B. Paulsen
  12.  *
  13.  *    This file contains the private emulation calls for the NCSA
  14.  *  Virtual Screen Kernel.
  15.  *
  16.  *      Version Date    Notes
  17.  *      ------- ------  ---------------------------------------------------
  18.  *      0.01    861102  Initial coding -GBP
  19.  *      0.10    861111  Added/Modified VT emulator -GBP
  20.  *      0.50    861113  First compiled edition -GBP
  21.  *        2.1        871130    NCSA Telnet 2.1 -GBP
  22.  *        2.2     880715    NCSA Telnet 2.2 -GBP
  23.  */
  24.  
  25. #include <QuickDraw.h>
  26. #include <Controls.h>
  27.  
  28. #include "vsdata.h"
  29. #include "vskeys.h"
  30. #include "rsmac.h"
  31. #include "vsintern.h"
  32.  
  33. void VSem
  34.   (
  35.     register unsigned char *c, /* pointer to character string */
  36.     register int ctr /* length of character string */
  37.   )
  38.   /* basic routine for placing characters on a virtual screen, and
  39.     interpreting control characters and escape sequences. Simple
  40.     interpretation of controls & escapes is done here, while the
  41.     harder stuff is done by calling VSIxx routines in vsintern.c. */
  42.   {
  43.     register int sx;
  44.     register int escflg; /* state of escape sequence interpretation */
  45.     int insert, attrib, extra, offend;
  46.     char *acurrent, *current, *start;
  47.  
  48.     escflg = VSIw->escflg;
  49.  
  50.     while (ctr > 0)
  51.       {
  52.         while ((escflg == 0) && (ctr > 0) && (*c < 32))
  53.           {
  54.             switch (*c)
  55.               {
  56.                 case 0x1b: /* esc */
  57.                     escflg++;
  58.                     break;
  59.                 case 0x0e: /* shift out */
  60.                     if (VSIw->G1)
  61.                         VSIw->attrib = VSgraph(VSIw->attrib);
  62.                     else
  63.                         VSIw->attrib = VSnotgraph(VSIw->attrib);
  64.                     VSIw->charset = 1;
  65.                     break;
  66.                 case 0x0f: /* shift in */
  67.                     if (VSIw->G0)
  68.                         VSIw->attrib = VSgraph(VSIw->attrib);
  69.                     else
  70.                         VSIw->attrib = VSnotgraph(VSIw->attrib);
  71.                     VSIw->charset = 0;
  72.                     break;
  73.                 case 0x07: /* bell */
  74.                     RSbell(VSIwn);
  75.                     break;
  76.                 case 0x08: /* backspace */
  77.                     VSIw->x--;
  78.                     if (VSIw->x < 0)
  79.                       /* hit left margin */
  80.                         VSIw->x = 0;
  81.                     break;
  82.                 case 0x0c: /* ff */
  83.                     VSIindex();
  84.                     break;
  85.                 case 0x09: /* ht */        /* Later change for versatile tabbing */
  86.                     VSItab();
  87.                     VScapture(c,1);                /* BYU 2.4.18 */
  88.                     break;
  89.                 case 0x0a: /* lf */
  90.                     VSIindex();
  91.                     break;
  92.                 case 0x0d: /* cr */
  93.                     VSIw->x = 0;
  94.                     VScapture(c,1);                /* BYU 2.4.18 */
  95.                     break;
  96.                 case 0x0b: /* vt */
  97.                     VSIindex();
  98.                     break;
  99. #ifdef CISB
  100.                 case 0x10: /* dle */
  101.                     bp_DLE(c, ctr);
  102.                     ctr = 0;
  103.                     break;
  104.                 case 0x05: /* enq */
  105.                     bp_ENQ();
  106.                     break;
  107. #endif CISB
  108.               } /* switch */
  109.             c++;
  110.             ctr--;
  111.           } /* while */
  112.         if ((escflg == 0) && (ctr > 0) && (*c & 0x80))    /* BYU 2.4.12 - VT220 starts here */
  113.           {                                                /* BYU 2.4.12 */
  114.             switch (*c)                                    /* BYU 2.4.12 */
  115.               {                                            /* BYU 2.4.12 */
  116.                 case 0x84: /* ind */            /* BYU 2.4.12 - same as ESC D */
  117.                     VSIindex();                    /* BYU 2.4.12 */
  118.                     goto ShortCut;                /* BYU 2.4.12 */
  119.                 case 0x85: /* nel */            /* BYU 2.4.12 - same as ESC E */
  120.                     VSIw->x = 0;                /* BYU 2.4.12 */
  121.                     VSIindex();                    /* BYU 2.4.12 */
  122.                     goto ShortCut;                /* BYU 2.4.12 */
  123.                 case 0x88: /* hts */            /* BYU 2.4.12 - same as ESC H */
  124.                     VSIw->tabs[VSIw->x] = 'x';    /* BYU 2.4.12 */
  125.                     goto ShortCut;                /* BYU 2.4.12 */
  126.                 case 0x8d: /* ri */                /* BYU 2.4.12 - same as ESC M */
  127.                     VSIrindex();                /* BYU 2.4.12 */
  128.                     goto ShortCut;                /* BYU 2.4.12 */
  129.                 case 0x9b: /* csi */            /* BYU 2.4.12 - same as ESC [ */
  130.                     VSIapclear();                /* BYU 2.4.12 */
  131.                     escflg = 2;                    /* BYU 2.4.12 */
  132.                     break;                        /* BYU 2.4.12 */
  133.                 case 0x86: /* ssa */            /* BYU 2.4.12 - same as ESC F */
  134.                 case 0x87: /* esa */            /* BYU 2.4.12 - same as ESC G */
  135.                 case 0x8e: /* ss2 */            /* BYU 2.4.12 - same as ESC N */
  136.                 case 0x8f: /* ss3 */            /* BYU 2.4.12 - same as ESC O */
  137.                 case 0x90: /* dcs */            /* BYU 2.4.12 - same as ESC P */
  138.                 case 0x93: /* sts */            /* BYU 2.4.12 - same as ESC S */
  139.                 case 0x96: /* spa */            /* BYU 2.4.12 - same as ESC V */
  140.                 case 0x97: /* epa */            /* BYU 2.4.12 - same as ESC W */
  141.                 case 0x9d: /* osc */            /* BYU 2.4.12 - same as ESC ] */
  142.                 case 0x9e: /* pm */                /* BYU 2.4.12 - same as ESC ^ */
  143.                 case 0x9f: /* apc */            /* BYU 2.4.12 - same as ESC _ */
  144.                     goto ShortCut;                /* BYU 2.4.12 */
  145.               } /* switch */                    /* BYU 2.4.12 */
  146.             c++;                                /* BYU 2.4.12 */
  147.             ctr--;                                /* BYU 2.4.12 */
  148.           } /* if */                            /* BYU 2.4.12 */
  149.         while ((ctr > 0) && (escflg == 0) && (*c >= 32))
  150.           {
  151.           /* display printing characters */
  152.             start = &VSIw->linest[VSIw->y]->text[VSIw->x]; /* start of area needing redrawing */
  153.             current = start; /* where to put next char */
  154.             acurrent = &VSIw->attrst[VSIw->y]->text[VSIw->x]; /* where to put corresponding attribute byte */
  155.             attrib = VSIw->attrib; /* current writing attribute */
  156.             insert = VSIw->IRM; /* insert mode (boolean) */
  157.             offend = 0; /* wrapped to next line (boolean) */
  158.             extra = 0; /* overwriting last character of line (boolean) */
  159.             sx = VSIw->x; /* starting column of area needing redrawing */
  160.             if (VSIw->x > VSIw->maxwidth)
  161.               {
  162.                 if (VSIw->DECAWM)
  163.                   {
  164.                   /* wrap to next line */
  165.                     VSIw->x = 0;
  166.                     VSIindex();
  167.                   }
  168.                 else
  169.                   /* stay at right margin */
  170.                     VSIw->x = VSIw->maxwidth;
  171.                 current = start = &VSIw->linest[VSIw->y]->text[VSIw->x];
  172.                 acurrent = &VSIw->attrst[VSIw->y]->text[VSIw->x];
  173.                 sx = VSIw->x;
  174.               } /* if */
  175.             while ((ctr > 0) && (*c >= 32) && (offend == 0))
  176.               {
  177.               /* write characters within a single line */
  178.                 if (insert)
  179.                   /* make room for the char */
  180.                     VSIinschar(1);
  181.               /* poke the character and its attribute into the
  182.                 screen buffer at the current cursor position */
  183.                 *current = *c;
  184.                 *acurrent = attrib;
  185.                 c++;
  186.                 ctr--;
  187.                 if (VSIw->x < VSIw->maxwidth)
  188.                   {
  189.                   /* advance the cursor position */
  190.                     acurrent++;
  191.                     current++;
  192.                     VSIw->x++;
  193.                   }
  194.                 else
  195.                   {
  196.                   /* hit right margin */
  197.                     if (VSIw->DECAWM)
  198.                       {
  199.                       /* autowrap to start of next line */
  200.                         VSIw->x++;
  201.                         offend = 1; /* terminate inner loop */
  202.                       }
  203.                     else
  204.                       {
  205.                       /* stay at right margin */
  206.                         VSIw->x = VSIw->maxwidth;
  207.                         extra = 1; /* cursor position doesn't advance */
  208.                       } /* if */
  209.                   } /* if */
  210.               } /* while */
  211.           /* update the screen to show what I've done */
  212.               extra += VSIw->x - sx + offend;                                    /* BYU 2.4.18 */
  213.             if (insert)
  214.                 VSIinsstring(extra, start);                                    /* BYU 2.4.18 */
  215.                                     /* actually just decides which RS to use */
  216.             else
  217.                 VSIdraw(VSIwn, sx, VSIw->y, VSIw->attrib, extra, start);    /* BYU 2.4.18 */
  218.             VScapture((unsigned char *) start, extra);                        /* BYU 2.4.18 */
  219.           } /* while */
  220.  
  221.         while((ctr > 0) && (escflg == 1))
  222.           { /* basic escape sequence processing */
  223.             switch (*c)
  224.               {
  225.                 case 0x08:
  226.                     VSIw->x--;
  227.                     if (VSIw->x < 0)
  228.                         VSIw->x = 0;
  229.                     break;
  230.                 case '[': /* csi */
  231.                     VSIapclear();
  232.                     escflg++;
  233.                     break;
  234.                 case '7':
  235.                     VSIsave();
  236.                     goto ShortCut;                /* BYU 2.4.12 */
  237.                 case '8':
  238.                     VSIrestore();
  239.                     goto ShortCut;                /* BYU 2.4.12 */
  240.                 case 'c':
  241.                     VSIreset();
  242.                     break;
  243.                 case 'D':
  244.                     VSIindex();
  245.                     goto ShortCut;                /* BYU 2.4.12 */
  246.                 case 'E':
  247.                     VSIw->x = 0;
  248.                     VSIindex();
  249.                     goto ShortCut;                /* BYU 2.4.12 */
  250.                 case 'M':
  251.                     VSIrindex();
  252.                     goto ShortCut;                /* BYU 2.4.12 */
  253.                 case '>':
  254.                     VSIw->DECPAM = 0;
  255.                     goto ShortCut;                /* BYU 2.4.12 */
  256.                 case '=':
  257.                     VSIw->DECPAM = 1;
  258.                     goto ShortCut;                /* BYU 2.4.12 */
  259.                 case 'Z':
  260.                     VTsendident();
  261.                     goto ShortCut;                /* BYU 2.4.12 */
  262.                 case ' ':                        /* BYU 2.4.12 */
  263.                 case '*':                        /* BYU 2.4.12 */
  264.                 case '#':
  265.                     escflg = 3;
  266.                     break;
  267.                 case '(':
  268.                     escflg = 4;
  269.                     break;
  270.                 case ')':
  271.                     escflg = 5;
  272.                     break;
  273.                 case 'H':
  274.                     VSIw->tabs[VSIw->x] = 'x';
  275.                     goto ShortCut;                /* BYU 2.4.12 */
  276. #ifdef CISB
  277.                 case 'I':
  278.                     bp_ESC_I();
  279.                     break;
  280. #endif CISB
  281.                 default:
  282.                     goto ShortCut;                /* BYU 2.4.12 */
  283.               } /* switch */
  284.             c++;
  285.             ctr--;
  286.           } /* while */
  287.         while ((escflg == 2) && (ctr > 0))
  288.           { /* "control sequence" processing */
  289.             switch (*c)
  290.               {
  291.                 case 0x08:
  292.                     VSIw->x--;
  293.                     if (VSIw->x < 0)
  294.                         VSIw->x = 0;
  295.                     break;
  296.                 case '0':
  297.                 case '1':
  298.                 case '2':
  299.                 case '3':
  300.                 case '4':
  301.                 case '5':
  302.                 case '6':
  303.                 case '7':
  304.                 case '8':
  305.                 case '9':
  306.                   /* parse numeric parameter */
  307.                     if (VSIw->parms[VSIw->parmptr] < 0)
  308.                         VSIw->parms[VSIw->parmptr] = 0;
  309.                     VSIw->parms[VSIw->parmptr] *= 10;
  310.                     VSIw->parms[VSIw->parmptr] += *c - '0';
  311.                     break;
  312.                 case '?':
  313.                   /* DEC-private control sequence */
  314.                     VSIw->parms[VSIw->parmptr++] = -2;
  315.                     break;
  316.                 case ';':
  317.                   /* parameter separator */
  318.                     VSIw->parmptr++;
  319.                     break;
  320.                 case 'A': /* cursor up */
  321. #if 1                                                        /* BYU */
  322.                     if (VSIw->parms[0]<1) VSIw->y--;        /* BYU */
  323.                     else VSIw->y-=VSIw->parms[0];            /* BYU */
  324.                     if ( VSIw->y < 0 ) VSIw->y=0;            /* BYU */
  325. #else                                                        /* BYU */
  326.                     if (VSIw->y < VSIw->top)
  327.                       {
  328.                       /* outside scrolling region */
  329.                         if (VSIw->parms[0] < 1)
  330.                             VSIw->y--;
  331.                         else
  332.                             VSIw->y -= VSIw->parms[0];
  333.                       }
  334.                     else
  335.                       {
  336.                       /* don't leave scrolling region */
  337.                         if (VSIw->parms[0] < 1)
  338.                             VSIw->y--;
  339.                         else
  340.                             VSIw->y -= VSIw->parms[0];
  341.                         if (VSIw->y < VSIw->top)
  342.                             VSIw->y = VSIw->top;
  343.                       }
  344. #endif                                                        /* BYU */
  345.                     VSIrange();
  346.                     goto ShortCut;                /* BYU 2.4.12 */
  347.                 case 'B': /* cursor down */
  348. #if 1                                                        /* BYU */
  349.                     if (VSIw->parms[0]<1) VSIw->y++;        /* BYU */
  350.                     else VSIw->y+=VSIw->parms[0];            /* BYU */
  351.                     if ( VSIw->y > VSIw->lines )             /* BYU */
  352.                         VSIw->y=VSIw->lines;                /* BYU */
  353. #else                                                        /* BYU */
  354.                     if (VSIw->y > VSIw->bottom)
  355.                       {
  356.                       /* outside scrolling region */
  357.                         if (VSIw->parms[0] < 1)
  358.                             VSIw->y++;
  359.                         else
  360.                             VSIw->y += VSIw->parms[0];
  361.                       }
  362.                     else
  363.                       {
  364.                       /* don't leave scrolling region */
  365.                         if (VSIw->parms[0] < 1)
  366.                             VSIw->y++;
  367.                         else
  368.                             VSIw->y += VSIw->parms[0];
  369.                         if (VSIw->y > VSIw->bottom)
  370.                             VSIw->y = VSIw->bottom;
  371.                       }
  372. #endif                                                        /* BYU */
  373.                     VSIrange();
  374.                     goto ShortCut;                /* BYU 2.4.12 */
  375.                 case 'C': /* cursor right */
  376.                     if (VSIw->parms[0] < 1)
  377.                         VSIw->x++;
  378.                     else
  379.                         VSIw->x += VSIw->parms[0];
  380.                     VSIrange();
  381.                     if (VSIw->x > VSIw->maxwidth)
  382.                         VSIw->x = VSIw->maxwidth;
  383.                     goto ShortCut;                /* BYU 2.4.12 */
  384.                 case 'D': /* cursor left */
  385.                     if (VSIw->parms[0] < 1)
  386.                         VSIw->x--;
  387.                     else
  388.                         VSIw->x -= VSIw->parms[0];
  389.                     VSIrange();
  390.                     goto ShortCut;                /* BYU 2.4.12 */
  391.                 case 'f':
  392.                 case 'H':
  393.                   /* absolute cursor positioning */
  394.                     VSIw->x = VSIw->parms[1] - 1;
  395.                     if (VSIw->DECORG)
  396.                       /* origin mode -- position relative to top of scrolling region */
  397.                         VSIw->y = VSIw->parms[0] - 1 + VSIw->top;
  398.                     else
  399.                         VSIw->y = VSIw->parms[0] - 1;
  400.                     VSIrange();
  401.                     goto ShortCut;                /* BYU 2.4.12 */
  402.                 case 'K':
  403.                   /* erase to beginning/end/whole of line */
  404.                     switch (VSIw->parms[0])
  405.                       {
  406.                         case -1:
  407.                         case  0:
  408.                             VSIeeol();
  409.                             break;
  410.                         case  1:
  411.                             VSIebol();
  412.                             break;
  413.                         case  2:
  414.                             VSIel(-1);
  415.                             break;
  416.                         default:
  417.                             goto ShortCut;        /* BYU 2.4.12 */
  418.                       } /* switch */
  419.                     goto ShortCut;                /* BYU 2.4.12 */
  420.                 case 'J':
  421.                   /* erase to beginning/end/whole of screen */
  422.                     switch (VSIw->parms[0])
  423.                       {
  424.                         case -1:
  425.                         case  0:
  426.                             VSIeeos();
  427.                             break;
  428.                         case  1:
  429.                             VSIebos();
  430.                             break;
  431.                         case  2:
  432.                             VSIes();
  433.                             break;
  434.                         default:
  435.                             goto ShortCut;        /* BYU 2.4.12 */
  436.                       } /* switch */
  437.                     goto ShortCut;                /* BYU 2.4.12 */
  438.                 case 'm':
  439.                   /* set/clear attributes */
  440.                   {
  441.                     int temp = 0;
  442.                     while (temp <= VSIw->parmptr)
  443.                       {
  444.                         if (VSIw->parms[temp] < 1)
  445.                             VSIw->attrib &= 128; /* turn them all off */
  446.                         else if (VSIw->parms[temp] > 20)                        /* BYU 2.4.13 */
  447.                           /* turn off the appropriate bit */                    /* BYU 2.4.13 */
  448.                             VSIw->attrib &= ~(1 << (VSIw->parms[temp] - 21));    /* BYU 2.4.13 */
  449.                         else
  450.                           /* turn on the appropriate bit */
  451.                             VSIw->attrib |= 1 << (VSIw->parms[temp] - 1);
  452.                         temp++;
  453.                       } /* while */
  454.                   }
  455.                   goto ShortCut;                /* BYU 2.4.12 */
  456.                 case 'q':
  457.                   /* flash dem LEDs. What LEDs? */
  458.                     goto ShortCut;                /* BYU 2.4.12 */
  459.                 case 'c':
  460.                     VTsendident();
  461.                     goto ShortCut;                /* BYU 2.4.12 */
  462.                 case 'n':
  463.                     switch (VSIw->parms[0])
  464.                       {
  465.                         case 5:
  466.                             VTsendstat();
  467.                             break;
  468.                         case 6:
  469.                             VTsendpos();
  470.                             break;
  471.                       } /* switch */
  472.                     goto ShortCut;                /* BYU 2.4.12 */
  473.                 case 'L':
  474.                     if (VSIw->parms[0] < 1)
  475.                         VSIw->parms[0] = 1;
  476.                     VSIinslines(VSIw->parms[0], -1);
  477.                     goto ShortCut;                /* BYU 2.4.12 */
  478.                 case 'M':
  479.                     if (VSIw->parms[0] < 1)
  480.                         VSIw->parms[0] = 1;
  481.                     VSIdellines(VSIw->parms[0], -1);
  482.                     goto ShortCut;                /* BYU 2.4.12 */
  483.                 case 'P':
  484.                     if (VSIw->parms[0] < 1)
  485.                         VSIw->parms[0] = 1;
  486.                     VSIdelchars(VSIw->parms[0]);
  487.                     goto ShortCut;                /* BYU 2.4.12 */
  488.                 case 'r':
  489.                   /* set scrolling region */
  490.                     if (VSIw->parms[0] < 0)
  491.                         VSIw->top = 0;
  492.                     else
  493.                         VSIw->top = VSIw->parms[0] - 1;
  494.                     if (VSIw->parms[1] < 0)
  495.                         VSIw->bottom = VSIw->lines;
  496.                     else
  497.                         VSIw->bottom = VSIw->parms[1] - 1;
  498.                     if (VSIw->top < 0)
  499.                         VSIw->top = 0;
  500.                     if (VSIw->top > VSIw->lines - 1)
  501.                         VSIw->top = VSIw->lines - 1;
  502.                     if (VSIw->bottom < 1)
  503.                         VSIw->bottom = VSIw->lines;
  504.                     if (VSIw->bottom > VSIw->lines)
  505.                         VSIw->bottom = VSIw->lines;
  506.                     VSIw->x = 0;
  507.                     VSIw->y = 0;
  508.                     if (VSIw->DECORG)
  509.                         VSIw->y = VSIw->top;    /* origin mode relative */
  510.                     goto ShortCut;                /* BYU 2.4.12 */
  511.                 case 'h':
  512.                   /* set options */
  513.                     VSIsetoption(1);
  514.                     goto ShortCut;                /* BYU 2.4.12 */
  515.                 case 'l':
  516.                   /* reset options */
  517.                     VSIsetoption(0);
  518.                     goto ShortCut;                /* BYU 2.4.12 */
  519.                 case 'g':
  520.                     if (VSIw->parms[0] == 3)
  521.                       /* clear all tabs */
  522.                         VSItabclear();
  523.                     else if (VSIw->parms[0] == 0 || VSIw->parms[0] < 0)
  524.                       /* clear tab at current position */
  525.                         VSIw->tabs[VSIw->x] = ' ';
  526.                     goto ShortCut;                /* BYU 2.4.12 */
  527.                 case '!':                        /* BYU 2.4.12 - More private DEC stuff? */
  528.                 case '\'':                        /* BYU 2.4.12 - More private DEC stuff? */
  529.                 case '\"':                        /* BYU 2.4.12 - More private DEC stuff? */
  530.                     escflg++;                    /* BYU 2.4.12 */
  531.                     break;                        /* BYU 2.4.12 */
  532.                 default:            /* Dang blasted strays... */
  533.                     goto ShortCut;                /* BYU 2.4.12 */
  534.               } /* switch */
  535.             c++;
  536.             ctr--;
  537.           } /* while */
  538.     
  539.         while ((escflg == 3) && (ctr > 0))
  540.           {    /* "#" handling */
  541.           /* no support for double-width and double-height characters yet */
  542.             switch (*c)
  543.               {
  544.                 case 0x08:
  545.                     VSIw->x--;
  546.                     if (VSIw->x < 0)
  547.                         VSIw->x = 0;
  548.                     break;
  549.                 case '8': /* alignment display */
  550.                     VTalign();
  551.                     goto ShortCut;                /* BYU 2.4.12 */
  552.                 default:
  553.                     goto ShortCut;                /* BYU 2.4.12 */
  554.               } /* switch */
  555.             c++;
  556.             ctr--;
  557.           } /* while */
  558.  
  559.         while ((escflg == 4) && (ctr > 0))
  560.           {    /* "(" handling (selection of G0 character set) */
  561.             switch (*c)
  562.               {
  563.                 case 0x08:
  564.                     VSIw->x--;
  565.                     if (VSIw->x < 0)
  566.                         VSIw->x = 0;
  567.                     break;
  568.                 case 'A': /* UK */
  569.                 case 'B': /* US */
  570.                 case '1': /* "soft" */
  571.                     VSIw->G0 = 0;
  572.                     if (!VSIw->charset)
  573.                         VSIw->attrib = VSnotgraph(VSIw->attrib);
  574.                     goto ShortCut;                /* BYU 2.4.12 */
  575.                 case '0': /* DEC special graphics */
  576.                 case '2': /* "soft" */
  577.                     VSIw->G0 = 1;
  578.                     if (!VSIw->charset)
  579.                         VSIw->attrib = VSgraph(VSIw->attrib);
  580.                     goto ShortCut;                /* BYU 2.4.12 */
  581.                 default:
  582.                     goto ShortCut;                /* BYU 2.4.12 */
  583.               } /* switch */
  584.             c++;
  585.             ctr--;
  586.           } /* while */
  587.     
  588.         while ((escflg == 5) && (ctr > 0))
  589.           {    /* ")" handling (selection of G1 character set) */
  590.             switch (*c)
  591.               {
  592.                 case 0x08:
  593.                     VSIw->x--;
  594.                     if (VSIw->x < 0)
  595.                         VSIw->x = 0;
  596.                     break;
  597.                 case 'A': /* UK */
  598.                 case 'B': /* US */
  599.                 case '1': /* "soft" */
  600.                     VSIw->G1 = 0;
  601.                     if (VSIw->charset)
  602.                         VSIw->attrib = VSnotgraph(VSIw->attrib);
  603.                     goto ShortCut;                /* BYU 2.4.12 */
  604.                 case '0': /* DEC special graphics */
  605.                 case '2': /* "soft" */
  606.                     VSIw->G1 = 1;
  607.                     if (VSIw->charset)
  608.                         VSIw->attrib = VSgraph(VSIw->attrib);
  609.                     goto ShortCut;                /* BYU 2.4.12 */
  610.                 default:
  611.                     goto ShortCut;                /* BYU 2.4.12 */
  612.               } /* switch */
  613.             c++;
  614.             ctr--;
  615.           } /* while */
  616.  
  617.         if ((escflg > 2) && (ctr > 0))
  618.           {
  619. ShortCut:                        /* BYU 2.4.12 - well, sacrificing style for speed */
  620.             escflg = 0;
  621.             c++;
  622.             ctr--;
  623.           } /* if */
  624.       } /* while (ctr > 0) */
  625.     VSIw->escflg = escflg;
  626.   } /* VSem */
  627.  
  628.